class ArrayList<T>{
    arr: Array<T>;
    index: number = 0;

    constructor() {
        this.arr=[]
    }

    add(ele: T) {
        this.arr[this.index++] = ele;
    }
    get(index: number) {
        return this.arr[index];
    }
}

let arrList = new ArrayList<string>();
arrList.add("abc");
console.log(arrList.get(0));

let arrList2 = new ArrayList<{ username:string, age: number; }>();
arrList2.add({ username: "张三", age: 18 });
console.log(arrList2.get(0));

export {}
